﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using xTeam.HengLe.DataAccess;
using xTeam.HengLe.Entity;
using xTeam.HengLe.Enums;

namespace xTeam.HengLe.Controller.Website
{
    public class AdvertiseController : BaseController
    {
        private AdvertiseDataAccess _advertiseDataAccess;

        public AdvertiseController()
        {
            _advertiseDataAccess = new AdvertiseDataAccess(_connectionString);
        }
        /// <summary>
        /// 广告首页,只能切换
        /// </summary>
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 幻灯片专用
        /// </summary>
        public ActionResult Slide(int aid = 0)
        {
            EAdvertise ad = _advertiseDataAccess.SelectById(aid);
            if (ad != null)
                if ((AdType)ad.Type == AdType.Slide)
                    Response.Write(ad.Contents);
            return new EmptyResult();

        }
    }
}
